<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js基础2</title>
</head>
<body>
    <script>
        var color = 250;
        console.log(color.toString(16));
        var person = {
            age:16,
            weight:100,
            say : function(msg) {
                return msg;

            }
        };
        // const book {}
        console.log(person['age']);
        person.age = 19;
        console.log(person.say('hi'));
        console.log(person.age);
        // // for(var i in person) {
        // //     console.log(key, person[key]);
        // }
        // console.log(person[age]);

        var computer = new Object();
        console.log(typeof computer);
        JSON.stringify(typeof computer);

        // ()={
        //     console.log('这是来自匿名函数的信息')
        // }；

        // function plus(a, b = 1) {
        //     var c = 2020
        //     console.log(a + b);
        // }
        // console.log(c);
        // plus(2, 3);
        // plus(5);

        var books = ['javascript', 'HTML5', '插入CSS', 'Vue'];
        console.log(books, length, books['length'], books[0],books['0']);
        books.push('node');
        console.log(books.length, books[4]);
        delete books[4];
        console.log(books.length,books[4]);
        books.forEach(function (item, key) {
            console.log(item, key);
        });
        var another = books.map(function (item, key) {
            console.log(key, item);
        })
        another.forEach((item,key) => {
            console.log(item, key);
        })

        
    </script>
</body>
</html>